package com.ccrfid.rmc6.repository.business.prison.patrolcheck;

import com.ccrfid.rmc6.entity.business.prison.patrolcheck.PatrolCheckPointEntity;
import com.ccrfid.rmc6.repository.search.SearchableRepository;
import org.springframework.data.repository.Repository;

import java.util.List;

public interface PatrolCheckPointRepository extends Repository<PatrolCheckPointEntity, Long>,
        SearchableRepository<PatrolCheckPointEntity> {

    PatrolCheckPointEntity getById(Long id);

    List<PatrolCheckPointEntity> getAllByGroupId(Long groupId);

    Boolean existsById(Long id);

    Boolean existsByGroupId(Long groupId);

    Boolean existsByGroupIdAndId(Long groupId, Long id);

    Boolean existsByGroupIdAndCardNumber(Long groupId, Long cardNumber);

    Boolean existsByGroupIdAndCardNumberAndIdNot(Long groupId, Long cardNumber, Long id);

    PatrolCheckPointEntity save(PatrolCheckPointEntity entity);

    void deleteById(Long id);

    void deleteAllByGroupId(Long groupId);
}
